//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#pragma GCC optimize("Ofast","unroll-loops","inline")
#include<bits/stdc++.h>
#define ll long long
//#define int ll
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define piii pair<int,pii>
#define fi first
#define se second
using namespace std;
const int N=6e5+10,M=6e5+10,mod=998244353;
const int Inf=1e9;
vector<int> e[N],G[N];
int n,m,a,b,dis[N][2],d[N][2],u[N],v[N],in[N];
bool vis[N][2];
priority_queue<piii,vector<piii> ,greater<piii> > q;
map<pii,int> mp;
int cnt,vs[N];
inline int id(int x,int y){
	if(x>y) swap(x,y);
	if(!mp.count(MP(x,y))) return mp[MP(x,y)]=++cnt;
	else return mp[MP(x,y)]; 
}
vector<int> cir[N],vec[N][2];
bool flg[N];int tot; 
inline bool chk(int x,int y){
	int i=id(x,y),res=0;
	for(int v:cir[i]) res+=flg[v];
	return res!=tot;
}
signed main(){
	freopen("edge.in","r",stdin);
	freopen("edge.out","w",stdout);
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>n>>m>>a>>b;
	for(int i=1,x,y;i<=m;i++) cin>>x>>y,e[x].pb(y),e[y].pb(x),u[i]=x,v[i]=y,in[x]++,in[y]++;
	for(int i=1;i<=m;i++){
		if(in[u[i]]>in[v[i]]||(in[u[i]]==in[v[i]]&&u[i]>v[i])) swap(u[i],v[i]);
		G[u[i]].pb(v[i]);
	}
	for(int i=1;i<=n;i++) for(int j=0;j<2;j++) dis[i][j]=Inf;
	dis[1][0]=0;
	q.push(MP(0,MP(1,0)));
	while(!q.empty()){
		pii u=q.top().se;q.pop();
		int x=u.fi,y=u.se;
		if(vis[x][y]) continue;
		vis[x][y]=1;
		for(int z:e[x]){
			if(dis[z][y^1]>dis[x][y]+1){
				dis[z][y^1]=dis[x][y]+1;
				q.push(MP(dis[z][y^1],MP(z,y^1)));
			}
		}
	} 
	if(b>=2*a){
		for(int i=2;i<=n;i++){
			int v=min(dis[i][0],dis[i][1]);
			cout<<1ll*v*a<<'\n';
		}
		return 0;
	}
	if(b>=a){
		for(int i=2;i<=n;i++){
			ll v=min(1ll*dis[i][0]/2*b,1ll*(dis[i][1]/2)*b+a);
			cout<<v<<'\n';
		}
	}
	else{
		for(int i=1;i<=n;i++){
			for(auto j:e[i]) vs[j]=1;
			for(auto j:e[i]){
				for(auto k:e[j]) if(vs[k]){
					if(i<j) cir[id(i,j)].pb(k);
				}
			}
			for(auto j:e[i]) vs[j]=0;
		}
		for(int i=1;i<=n;i++) for(int j=0;j<2;j++) d[i][j]=Inf;
		d[1][0]=0;
		memset(vis,0,sizeof(vis));
		q.push(MP(0,MP(1,0)));
		while(!q.empty()){
			pii u=q.top().se;q.pop();
			int x=u.fi,y=u.se;
			if(vis[x][y]) continue;
			vis[x][y]=1;
			tot=(int)vec[x][y].size();
			for(int v:vec[x][y]) flg[v]=1;
			for(int z:e[x]){
				if(y&&!chk(x,z)) continue;
//				if(z==2&&y) cout<<tot<<' '<<x<<' '<<"qwq\n";
				if(d[z][y^1]>d[x][y]+1){
					d[z][y^1]=d[x][y]+1;
					vec[z][y^1].clear();
					vec[z][y^1].pb(x); 
					q.push(MP(d[z][y^1],MP(z,y^1)));
				}
				else if(d[z][y^1]==d[x][y]+1) vec[z][y^1].pb(x);
			}
			for(int v:vec[x][y]) flg[v]=0;
			tot=0;
		}
		for(int i=2;i<=n;i++){
			ll v=min(1ll*dis[i][0]/2*b,1ll*(dis[i][1]/2)*b+a);
			if(dis[i][0]<dis[i][1]) cout<<v<<'\n';
			else{
//				if(i==2) cout<<"AWa: "<<d[i][0]<<'\n';
				v=min(1ll*d[i][0]/2*b,1ll*(dis[i][1]/2)*b+a);
				cout<<v<<'\n';
			}
		}
	}
	return 0;
}
/*
3 3 2 1
1 2
2 3
3 1
10 10 2 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1

883647902
176945524
*/ 
